﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FormItemCommissionCalculation.ascx.cs" Inherits="Apollo.Website.Controls_Edit_FormItemCommissionCalculation" %>


<script type="text/javascript">
    function ChangeCommissionCalculation(ddl, isFirstRun) {

        document.getElementById('calculation_xpmed').style.display = "none";
        document.getElementById('calculation_xprof').style.display = "none";
        document.getElementById('calculation_xpother').style.display = "none";
        document.getElementById('calculation_loading').style.display = "none";
        document.getElementById('calculation_payfreq').style.display = "none";

        if (!isFirstRun) {
            document.getElementById('<%= this.CheckBoxXPMed.ClientID %>').checked = false;
            document.getElementById('<%= this.CheckBoxXPProf.ClientID %>').checked = false;
            document.getElementById('<%= this.CheckBoxXPOther.ClientID %>').checked = false;
            document.getElementById('<%= this.CheckBoxLoading.ClientID %>').checked = false;
            document.getElementById('<%= this.CheckBoxPayFreq.ClientID %>').checked = false;
        }

        if (ddl.selectedIndex > 0) {
            var selValue = ddl.options[ddl.selectedIndex].value;

            switch (selValue) {
                case "1":
                    document.getElementById('calculation_payfreq').style.display = "block";
                    break;
                case "2":
                    document.getElementById('calculation_payfreq').style.display = "block";
                    break;
                case "3":
                    document.getElementById('calculation_xpmed').style.display = "block";
                    document.getElementById('calculation_xprof').style.display = "block";
                    document.getElementById('calculation_loading').style.display = "block";
                    document.getElementById('calculation_payfreq').style.display = "block";
                    break;
                case "4":
                    document.getElementById('calculation_xpmed').style.display = "block";
                    document.getElementById('calculation_xprof').style.display = "block";
                    document.getElementById('calculation_xpother').style.display = "block";
                    document.getElementById('calculation_loading').style.display = "block";
                    document.getElementById('calculation_payfreq').style.display = "block";
                    break;
            }
        }
    }


    $(document).ready(function () {
        ChangeCommissionCalculation(document.getElementById('<%= this.DropDownListCommissionCalculationBase.ClientID %>'), true);
    });
</script>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td width="50%" valign="top">
            <span class="property_name">Calculation base</span>
            <asp:DropDownList ID="DropDownListCommissionCalculationBase" runat="server" CssClass="property_value">
                <asp:ListItem Value="">Select</asp:ListItem>
                <asp:ListItem Value="">----------</asp:ListItem>
                <asp:ListItem Value="1">Suma asigurata</asp:ListItem>
                <asp:ListItem Value="2">Prima cf. frecventei</asp:ListItem>
                <asp:ListItem Value="3">Prima cf. frecventei fara XP</asp:ListItem>
                <asp:ListItem Value="4">Prima cf. frecventei cu incarcari</asp:ListItem>
            </asp:DropDownList>
        </td>
        <td width="50%" valign="top">
            <div id="calculation_xpmed">
                <asp:CheckBox ID="CheckBoxXPMed" runat="server" Text="XP Medical" />
            </div>
            <div id="calculation_xprof">
                <asp:CheckBox ID="CheckBoxXPProf" runat="server" Text="XP Profesional" />
            </div>
            <div id="calculation_xpother">
                <asp:CheckBox ID="CheckBoxXPOther" runat="server" Text="XP Alte" />
            </div>
            <div id="calculation_loading">
                <asp:CheckBox ID="CheckBoxLoading" runat="server" Text="Loading" />
            </div>
            <div id="calculation_payfreq">
                <asp:CheckBox ID="CheckBoxPayFreq" runat="server" Text="Frecventa Plata" />
            </div>
            
        </td>
    </tr>
</table>